<?php include_once 'common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once 'common/account_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
			<strong>资金管理</strong> &gt;&gt; 充值列表
		</div>
		<div class="admin_right_con">
			<table border="0" cellspacing="1" cellpadding="0">
			  <tr style="color:#0068b7;">
			  	<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>ID</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>用户名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>姓名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>类型</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>订单号</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>金额</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>手续费</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>类型</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>备注</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>充值时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>审核时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>状态</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>
			  <?php foreach($accountrecharge_list as $key=>$accountrecharge){?>
			  <tr>
			  	<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $accountrecharge['id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:search('<?php echo $accountrecharge['username'];?>');"><?php echo $accountrecharge['username'];?></a></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $accountrecharge['realname'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $user_loan[intval($accountrecharge['is_loan'])];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $accountrecharge['trade_no'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($accountrecharge['money'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($accountrecharge['fee'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $account_recharge_type[$accountrecharge['ftype']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $accountrecharge['remark'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('m-d H:i', $accountrecharge['add_time']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php if($accountrecharge['fstatus'] > 0){?><?php echo date('m-d H:i', $accountrecharge['verify_time']);?><?php }?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $account_recharge_status[$accountrecharge['fstatus']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF">
				<?php if($accountrecharge['fstatus'] == 0){?>
					<a href="javascript:verify(<?php echo $accountrecharge['id'];?>);">审核</a>
				<?php }?>
				</td>
			  </tr>
			  <?php }?>
			  <tr>
			  	<td colspan="13"  height="35" align="left" valign="middle" bgcolor="#FFFFFF">
			  		<form id="searchForm" action="/ychadmin/accountrecharge/accountrechargelist/" method="get">
			  			用户名：<input type="text" id="username" name="username" style="width: 100px;" value="<?php echo $username?>" />
			  			实名：<input type="text" id="realname" name="realname" style="width: 100px;" value="<?php echo $realname?>" />
			  			用户类型：<select id="is_loan" name="is_loan">
			  				<option value="-1" <?php if($is_loan==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($user_loan as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($is_loan==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			状态：<select id="fstatus" name="fstatus">
			  				<option value="-1" <?php if($fstatus==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($account_recharge_status as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($fstatus==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			类型：<select id="ftype" name="ftype">
			  				<option value="-1" <?php if($ftype==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($account_recharge_type as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($ftype==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			开始时间：<input type="text" id="strtime" name="strtime" style="width: 100px;" value="<?php echo $strtime;?>"  onfocus="WdatePicker()" />
			  			结束时间：<input type="text" id="endtime" name="endtime" style="width: 100px;" value="<?php echo $endtime;?>"  onfocus="WdatePicker()" />
			  			<input type="submit" value="查询" /><a href="/ychadmin/accountrecharge/accountrechargeexcel/?username=<?php echo $username;?>&realname=<?php echo $realname;?>&is_loan=<?php echo $is_loan;?>&fstatus=<?php echo $fstatus;?>&ftype=<?php echo $ftype;?>&strtime=<?php echo $strtime;?>&endtime=<?php echo $endtime;?>">导出数据</a>
			  		</form>
			  	</td>
			  </tr>
			  <tr><td colspan="13" class="page"  height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $this->pagination->create_links();?>共<?php echo $accountrecharge_count;?>条记录，总计金额：<?php echo $accountrecharge_total;?></td></tr>
			</table>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->

<div id="dialog" title="系统提示" style="display:none;">
<div id="msg" style="text-align:center;color:red">&nbsp;</div>
<input type="hidden" name="id" id="id" />
状态：<input type="radio" name="fstatus" id="fstatus" checked="checked" value="1"/>审核通过
	  <input type="radio" name="fstatus" id="fstatus" value="2"/>审核不通过 <br /><br />
备注：<textarea  id="verify_remark" name="verify_remark" style="width: 300px;height: 100px;">通过审核</textarea><br />
</div>
<script>
function search(username){
	$("#username").val(username);
	$("#searchForm").submit();
}

function verify(id){
	if(id>0){
		$( "#dialog" ).dialog({
			width:400,
			modal:true, //蒙层（弹出会影响页面大小）
			title:'充值审核',
			buttons:{"提交":function(){verifysub();},"关闭":function(){$(this).dialog("close");}}
		});
		$("#id").val(id);
	}
}

function verifysub(){
	$( "#dialog" ).dialog();
	if($('#verify_remark').val() == ''){
		$("#msg").html("请填写备注");
		return false;
	}
	$.ajax({
		type: "POST",
		url: "/ychadmin/accountrecharge/verify",
		data: "id="+$('#id').val()+"&fstatus="+$('input:radio[name="fstatus"]:checked').val()+"&verify_remark="+$('#verify_remark').val(),
		success: function(msg){
	        $( "#dialog" ).dialog();
	        if(msg=='1'){
	        	$("#msg").html("操作成功");
	        }else{
	        	$("#msg").html(msg);
		    }
			setTimeout(function(){
					location.reload();
			},3000);
		},
		dataType: "text"
	});
}
</script>
</body>
</html>
